package com.xhwl.centiotdata.handler.account.impl;

import com.xhwl.centiotdata.handler.account.AccountFactory;
import com.xhwl.centiotdata.handler.account.AccountHandler;
import com.xhwl.centiotdata.service.cent.ICentTalkBackService;
import com.xhwl.common.dto.cent.sdata.AccountDTO;
import com.xhwl.common.pojo.cent.device.DeviceProjSupplierCategory;
import com.xhwl.common.pojo.cent.sdata.personnel.StaffDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @description:
 * @author: wuyuhao
 * @createDate: 2023/5/5 9:42
 */
@Service
@Slf4j
public class AccountDnakeHandler extends AccountHandler {

    @Resource
    private ICentTalkBackService talkBackService;

    @Override
    public void afterPropertiesSet() throws Exception {
        // 狄耐克人行
        AccountFactory.register(101, this);
    }

    @Override
    public void add(StaffDTO dto, Integer projectId, DeviceProjSupplierCategory config) {
        Integer userId = dto.getAccountId();
        talkBackService.addSip(projectId, userId);
    }

    @Override
    public void delete(AccountDTO dto, Integer projectId, DeviceProjSupplierCategory config) {
        Integer userId = dto.getId();
        talkBackService.deleteSip(projectId, userId);
    }
}
